<?php
// check if recipe photo exists or take glass image otherwise
$photos = $this->recipe->getPhotos(1);
if($photos[0]){
	$file = APPLICATION_PATH.'/../public'.$photos[0]->getPhotoUrl();
} else {
	$file = APPLICATION_PATH.'/../public'.$this->recipe->getGlass()->getPhoto()->getPhotoUrl();
}
// determine image file type
$size = getimagesize($file);
$this->response->setHeader('Content-Type', $size['mime']);
// print image
print file_get_contents($file);
